﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ControlCustomer.ascx.cs" Inherits="UserControl_ControlCustomer" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="uscMsgBox.ascx" TagName="uscMsgBox" TagPrefix="uc1" %>
<script type="text/javascript">
    function pageLoad() {
        //số CMND
        $("#<%= txtSoCMND.ClientID %>").numeric();

        //ngày kỷ niệm
        $(function () {
            $("#<%= txtMemoryDate.ClientID %>").datePicker(
		{
		    clickInput: true,
		    startDate: '01/01/1950'
		   
		}
	);
});

        //ngày sinh
        $(function () {
            $("#<%= txtNgaySinh.ClientID %>").datePicker(
		{
		    clickInput: true,
		    startDate: '01/01/1950',
		    endDate: (new Date).getDate() + '/' + (new Date).getMonth() + '/' + ((new Date).getFullYear() - 18)
		}
	);
        });

        $("#<%= imgBtnAdd.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= imgBtnSave.ClientID %>").click(function () {
            if ($("#<%= txtHoTen.ClientID %>").val().length > 0 && $("#<%= txtDiaChiLienLac.ClientID %>").val().length > 0 && $("#<%= txtSoCMND.ClientID %>").val().length > 0) {
                $.blockUI({ css: {
                    border: 'none',
                    padding: '15px',
                    backgroundColor: '#000',
                    '-webkit-border-radius': '10px',
                    '-moz-border-radius': '10px',
                    opacity: .5,
                    color: '#fff'
                }
                });
            }
        });
        $("#<%= imgBtnDelete.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= imgBtnFind.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });
        $("#<%= btSearch.ClientID %>").click(function () {
            $.blockUI({ css: {
                border: 'none',
                padding: '15px',
                backgroundColor: '#000',
                '-webkit-border-radius': '10px',
                '-moz-border-radius': '10px',
                opacity: .5,
                color: '#fff'
            }
            });
        });

        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
        function EndRequestHandler(sender, args) {
            $.unblockUI();
        }
    }

</script>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
     <div class="direct_container_right_titletop">
                     Quản lý thông tin khách hàng
                </div>
                 <hr />
                <!-- Button chuc nang-->
                <div class="direct_container_main">
                    <asp:ImageButton ID="imgBtnAdd" onclick="imgBtnAdd_Click" CausesValidation="false" ImageUrl="~/Images/add.png" Width="32px" Height="32px" runat="server" />
                    <asp:ImageButton ID="imgBtnSave" onclick="imgBtnSave_Click" ImageUrl="~/Images/save.png" Width="32px" Height="32px" runat="server" />
                    <asp:ImageButton ID="imgBtnDelete" onclick="imgBtnDelete_Click" ImageUrl="~/Images/delete.png" Width="32px" Height="32px" runat="server" />
                    <asp:ImageButton ID="imgBtnFind" onclick="imgBtnFind_Click" CausesValidation="false" ImageUrl="~/Images/find.png" Width="32px" Height="32px" runat="server" />

                </div>
                <!-- End Button chuc nang-->
                <cc1:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1" 
            BackColor="#CCFFFF" Font-Names="Arial"  Height="500px" 
            Width="100%">
            <cc1:TabPanel ID="TabPanel1" runat="server" HeaderText="Nhập thông tin" TabIndex="0">
            <ContentTemplate>
            <div class="direct_container_main">
            <fieldset class="direct_fieldset">
            <legend class="direct_legend">Thông tin cá nhân</legend>
            <table border="0" width="100%">
                <tr><td width="12%" align="right">
                     <p class="direct_label">Mã khách hàng</p></td>
                     <td width="88%" align="left">
                        <asp:TextBox ID="txtMaSo" ReadOnly="True" CssClass="input_code" runat="server"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td align="right"><p class="direct_label">Họ tên<span>*</span></p></td>
                    <td align="left">
                        <asp:TextBox ID="txtHoTen" CssClass="input_full" runat="server"></asp:TextBox>
                                <asp:RequiredFieldValidator ControlToValidate="txtHoTen" Display="None" ID="RFVNganhHang"
                                            runat="server" ErrorMessage="Không được để rỗng họ tên!">
                                </asp:RequiredFieldValidator>
                                <cc1:ValidatorCalloutExtender TargetControlID="RFVNganhHang" ID="ValidatorCalloutExtender1"
                                            runat="server" Enabled="True">
                                            </cc1:ValidatorCalloutExtender></td>
               </tr>
               <tr>
               <td align="right">
                    <p class="direct_label">Địa chỉ liên lạc<span>*</span></p></td>
                    <td align="left">
                            <asp:TextBox ID="txtDiaChiLienLac" CssClass="input_full" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ControlToValidate="txtDiaChiLienLac" Display="None" ID="RFVDiaChiLienLac"
                                            runat="server" ErrorMessage="Không được để rỗng địa chỉ liên lạc!">
                            </asp:RequiredFieldValidator>
                            <cc1:ValidatorCalloutExtender TargetControlID="RFVDiaChiLienLac" ID="ValidatorCalloutExtender2"
                                            runat="server" Enabled="True"></cc1:ValidatorCalloutExtender>
                     </td>
              </tr>
              <tr>
              <td align="right">
                   <p class="direct_label">Số CMND<span>*</span></p></td>
                   <td align="left">
                            <asp:TextBox ID="txtSoCMND" CssClass="input_full" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ControlToValidate="txtSoCMND" Display="None" ID="RequiredFieldValidator1"
                                            runat="server" ErrorMessage="Phải nhập số CMND!">
                            </asp:RequiredFieldValidator>
                            <cc1:ValidatorCalloutExtender TargetControlID="RequiredFieldValidator1" ID="ValidatorCalloutExtender3"
                                            runat="server" Enabled="True">
                            </cc1:ValidatorCalloutExtender>
                    </td>
               </tr>
               <tr>
               <td align="right">
                   <p class="direct_label">Ngày sinh</p></td>
                   <td align="left">
                      <asp:TextBox ID="txtNgaySinh" CssClass="input_full" runat="server"></asp:TextBox>
                   </td>
               </tr>
               <tr>
               <td align="right">
                     <p class="direct_label">Ngày kỷ niệm</p></td>
                     <td align="left">
                     <asp:TextBox ID="txtMemoryDate" CssClass="input_full" runat="server"></asp:TextBox>
                     </td>
               </tr>
               <tr>
               <td align="right">
                      <p class="direct_label">Xưng hô</p></td><td align="left">
                      <asp:DropDownList ID="ddlXungHo" runat="server">
                                           
                      </asp:DropDownList>
               </td>
               </tr>
               </table>
               </fieldset> 
               <fieldset class="direct_fieldset">
                       <legend class="direct_legend">Thông tin Liên lạc</legend>
                       <table border="0" width="100%">
                            <tr>
                            <td align="right" width="12%">
                            <p class="direct_label">Địa chỉ thường trú</p></td>
                                            <td align="left" width="88%">
                               <asp:TextBox ID="txtDiaChiThuongTru" CssClass="input_full" runat="server"></asp:TextBox>
                            </td>
                            </tr>
                                            <tr><td align="right">
                                            <p class="direct_label">Tỉnh/Thành</p></td><td align="left">
                                            <asp:DropDownList ID="ddlTinhThanh" runat="server" CausesValidation="false"  AutoPostBack="true"
                                                     onselectedindexchanged="ddlTinhThanh_SelectedIndexChanged">
                                                     </asp:DropDownList>
                                                     </td></tr><tr><td align="right"  valign="top">
                                                     <p class="direct_label">Quận/Huyện</p></td>
                                                     <td align="left">
                                                     <asp:DropDownList ID="ddlQuanHuyen" runat="server"></asp:DropDownList>
                                                     </td></tr><tr><td align="right"><p class="direct_label">Nghề nghiệp</p></td><td align="left"><asp:TextBox ID="txtNgheNghiep" CssClass="input_full" runat="server"></asp:TextBox></td></tr><tr><td align="right"><p class="direct_label">Số điện thoại</p></td><td align="left"><asp:TextBox ID="txtMobile" CssClass="input_full" runat="server"></asp:TextBox></td></tr></table></fieldset> </div><!-- Content main-->
</ContentTemplate>
</cc1:TabPanel>
             <cc1:TabPanel ID="TabPanel2" runat="server" HeaderText="Tìm kiếm" TabIndex="1">
             <ContentTemplate>
<div class="direct_container_main">
    <div class="direct_container_form_right"><table border="0" width="100%"><tr>
            <td><p class="direct_legend">Nhập thông tin cần tìm</p></td></tr>
        <tr>
            <td 
                valign="middle"><asp:TextBox ID="txtSearch" CssClass="input_full" runat="server"></asp:TextBox>
<asp:Button ID="btSearch" CssClass="direct_bt_search" runat="server" Text="Tìm kiếm"
                                            OnClick="btSearch_Click" />
</td><tr><td>
                                            <asp:GridView ID="grvArcust" runat="server" AutoGenerateColumns="False" onpageindexchanging="grvArcust_PageIndexChanging" 
                                                        DataKeyNames="customer_key" EnableModelValidation="True" 
                                                        onrowcommand="grvArcust_RowCommand">
                                                <Columns>
<asp:TemplateField HeaderText="Stt">
    <HeaderTemplate>
STT
</HeaderTemplate>
<ItemTemplate>
                                                        <%# Container.DataItemIndex + 1 %>
                                                        
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Mã số">
    <HeaderTemplate>
Mã số
</HeaderTemplate>
<ItemTemplate>
                                                        
                                                          <asp:Label ID="lblMaSo" 
        runat="server" Text='<%# Eval("customer_key")%>'></asp:Label>
                                                        
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Họ tên">
    <HeaderTemplate>
Họ tên
</HeaderTemplate>
<ItemTemplate>
                                                         <%# Eval("customer_name")%>
                                                        
</ItemTemplate>

<HeaderStyle HorizontalAlign="Left" Width="50px" />

<ItemStyle Height="40px" HorizontalAlign="Left" Width="50px" />
</asp:TemplateField>
<asp:TemplateField><ItemTemplate>
<asp:ImageButton ID="imgBtnChon" runat="server" CausesValidation="False" CommandName="chon" Height="20px" 
                                                            ImageUrl="~/Images/check.png" />
</ItemTemplate>

<controlstyle backcolor="White" bordercolor="White"></controlstyle>

<FooterStyle BackColor="White" BorderColor="White"></FooterStyle>

<HeaderStyle BackColor="White" BorderColor="White" />

<ItemStyle BackColor="White" BorderColor="White" />
</asp:TemplateField>
</Columns>
</asp:GridView>
</td></tr></tr></table></div>
      
 
</ContentTemplate>
</cc1:TabPanel>
            </cc1:TabContainer>
    </ContentTemplate>
</asp:UpdatePanel>
<uc1:uscMsgBox ID="uscMsgBox1" runat="server" />